package cn.seqdata.rpt.cross;

import java.util.List;

import org.springframework.util.CollectionUtils;

public class Column {
	private String text;
	private String xtype;
	private String dataIndex;
	private Integer width;
	private List<Column> columns;

	public Column(String text, String xtype, String dataIndex) {
		this.text = text;
		this.xtype = xtype;
		this.dataIndex = dataIndex;
		this.width = "column".equals(xtype) ? 105 : 85;
	}

	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}

	public String getXtype() {
		return xtype;
	}

	public void setXtype(String xtype) {
		this.xtype = xtype;
	}

	public String getDataIndex() {
		return dataIndex;
	}

	public void setDataIndex(String dataIndex) {
		this.dataIndex = dataIndex;
	}

	public Integer getWidth() {
		return CollectionUtils.isEmpty(columns) ? width : null;
	}

	public void setWidth(Integer width) {
		this.width = width;
	}

	public List<Column> getColumns() {
		return columns;
	}

	public void setColumns(List<Column> columns) {
		this.columns = columns;
	}
}
